home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / CardRes.mod < prev    next >
Text File  |  1995-06-29  |  6KB  |  242 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: CardRes.mod $
  4.   Description: Interface to card.resource
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1990-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A Interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. *************************************************************************)
  21.  
  22. <* STANDARD- *>
  23.  
  24. MODULE [2] CardRes;
  25.  
  26. IMPORT SYS := SYSTEM, e := Exec, s := Sets;
  27.  
  28. (*
  29. **      $VER: card.h 1.11 (14.12.92)
  30. **
  31. **      card.resource include file
  32. *)
  33.  
  34. CONST
  35.  
  36.   cardResName * = "card.resource";
  37.  
  38. TYPE
  39.  
  40. (* Structures used by the card.resource                         *)
  41.  
  42.   CardHandlePtr * = POINTER TO CardHandle;
  43.   CardHandle  * = RECORD
  44.     node *     : e.Node;
  45.     removed *  : e.InterruptPtr;
  46.     inserted * : e.InterruptPtr;
  47.     status *   : e.InterruptPtr;
  48.     flags *    : s.SET8;
  49.   END;
  50.  
  51.   DeviceTDataPtr * = POINTER TO DeviceTData;
  52.   DeviceTData  * = RECORD
  53.     size *  : e.ULONG;       (* Size in bytes                *)
  54.     speed * : e.ULONG;       (* Speed in nanoseconds         *)
  55.     type *  : SHORTINT;      (* Type of card                 *)
  56.     flags * : s.SET8;        (* Other flags                  *)
  57.   END;
  58.  
  59.   CardMemoryMapPtr * = POINTER TO CardMemoryMap;
  60.   CardMemoryMap  * = RECORD
  61.     commonMemory *    : e.APTR;
  62.     attributeMemory * : e.APTR;
  63.     ioMemory *        : e.APTR;
  64.  
  65. (* Extended for V39 - These are the size of the memory spaces above *)
  66.  
  67.     commonMemSize *    : e.ULONG;
  68.     attributeMemSize * : e.ULONG;
  69.     ioMemSize *        : e.ULONG;
  70.  
  71.   END;
  72.  
  73. CONST
  74.  
  75. (* CardHandle.cah_CardFlags for OwnCard() function              *)
  76.  
  77.   resetRemove * = 0;
  78.   ifAvailable * = 1;
  79.   delayOwnership * = 2;
  80.   postStatus * = 3;
  81.  
  82. (* ReleaseCreditCard() function flags                           *)
  83.  
  84.   removeHandle * = 0;
  85.  
  86. (* ReadStatus() return flags                                    *)
  87.  
  88.   statusbCCDET * = 6;
  89.   statusbBVD1 * = 5;
  90.   statusbSC * = 5;
  91.   statusbBVD2 * = 4;
  92.   statusbDA * = 4;
  93.   statusbWR * = 3;
  94.   statusbBSY * = 2;
  95.   statusbIRQ * = 2;
  96.  
  97. (* CardProgramVoltage() defines *)
  98.  
  99.   voltage0v * = 0;                 (* Set to default; may be the same as 5V *)
  100.   voltage5v * = 1;
  101.   voltage12v * = 2;
  102.  
  103. (* CardMiscControl() defines *)
  104.  
  105.   enableDigAudio * = 1;
  106.   disableWP * = 3;
  107.  
  108. (*
  109.  * New CardMiscControl() bits for V39 card.resource.  Use these bits to set,
  110.  * or clear status change interrupts for BVD1/SC, BVD2/DA, and BSY/IRQ.
  111.  * Write-enable/protect change interrupts are always enabled.  The defaults
  112.  * are unchanged (BVD1/SC is enabled, BVD2/DA is disabled, and BSY/IRQ is enabled).
  113.  *
  114.  * IMPORTANT -- Only set these bits for V39 card.resource or greater (check
  115.  * resource base VERSION)
  116.  *
  117.  *)
  118.  
  119.   intbSetClr * = 7;
  120.   intbBVD1 * = 5;
  121.   intbSC * = 5;
  122.   intbBVD2 * = 4;
  123.   intbDA * = 4;
  124.   intbBSY * = 2;
  125.   intbIRQ * = 2;
  126.  
  127.  
  128. (* CardInterface() defines *)
  129.  
  130.   interfaceAmiga0 * = 0;
  131.  
  132. (*
  133.  * Tuple for Amiga execute-in-place software (e.g., games, or other
  134.  * such software which wants to use execute-in-place software stored
  135.  * on a credit-card, such as a ROM card).
  136.  *
  137.  * See documentatin for IfAmigaXIP().
  138.  *)
  139.  
  140.   cisTplAmigaXIP * = 091H;
  141.  
  142. TYPE
  143.  
  144.   TPAmigaXIPPtr * = POINTER TO TPAmigaXIP;
  145.   TPAmigaXIP  * = RECORD
  146.     code *  : SHORTINT;
  147.     link *  : SHORTINT;
  148.     loc *   : ARRAY 4 OF SHORTINT;
  149.     flags * : s.SET8;
  150.     resrv * : SHORTINT;
  151.   END;
  152.  
  153. CONST
  154.  
  155. (*
  156.  
  157.         ; The XIPFLAGB_AUTORUN bit means that you want the machine
  158.         ; to perform a reset if the execute-in-place card is inserted
  159.         ; after DOS has been started.  The machine will then reset,
  160.         ; and execute your execute-in-place code the next time around.
  161.         ;
  162.         ; NOTE -- this flag may be ignored on some machines, in which
  163.         ; case the user will have to manually reset the machine in the
  164.         ; usual way.
  165.  
  166. *)
  167.  
  168.   autoRun * = 0;
  169.  
  170. (**-- Library Base variable --------------------------------------------*)
  171.  
  172. (*
  173.  *  You have to put a pointer to the card.resource here to use the cia
  174.  *  procedures:
  175.  *)
  176.  
  177. VAR base* : e.APTR;
  178.  
  179. (**-- Library Functions ------------------------------------------------*)
  180.  
  181. (*
  182. **      $VER: cardres_protos.h 1.2 (8.9.92)
  183. *)
  184.  
  185. PROCEDURE OwnCard* [base,-6]
  186.   ( handle [9] : CardHandlePtr )
  187.   : CardHandlePtr;
  188. PROCEDURE ReleaseCard* [base,-12]
  189.   ( handle [9] : CardHandlePtr;
  190.     flags  [0] : e.ULONG );
  191. PROCEDURE GetCardMap* [base,-18] ()
  192.   : CardMemoryMapPtr;
  193. PROCEDURE BeginCardAccess* [base,-24]
  194.   ( handle [9] : CardHandlePtr )
  195.   : BOOLEAN;
  196. PROCEDURE EndCardAccess* [base,-30]
  197.   ( handle [9] : CardHandlePtr )
  198.   : BOOLEAN;
  199. PROCEDURE ReadCardStatus* [base,-36] ()
  200.   : e.UBYTE;
  201. PROCEDURE CardResetRemove* [base,-42]
  202.   ( handle [9] : CardHandlePtr;
  203.     flag   [0] : e.ULONG )
  204.   : BOOLEAN;
  205. PROCEDURE CardMiscControl* [base,-48]
  206.   ( handle      [9] : CardHandlePtr;
  207.     controlBits [1] : s.SET8 )
  208.   : s.SET8;
  209. PROCEDURE CardAccessSpeed* [base,-54]
  210.   ( handle      [9] : CardHandlePtr;
  211.     nanoseconds [0] : e.ULONG )
  212.   : e.ULONG;
  213. PROCEDURE CardProgramVoltage* [base,-60]
  214.   ( handle  [9] : CardHandlePtr;
  215.     voltage [0] : e.ULONG )
  216.   : LONGINT;
  217. PROCEDURE CardResetCard* [base,-66]
  218.   ( handle [9] : CardHandlePtr )
  219.   : BOOLEAN;
  220. PROCEDURE CopyTuple* [base,-72]
  221.   ( handle    [9] : CardHandlePtr;
  222.     buffer    [8] : ARRAY OF SYS.BYTE;
  223.     tuplecode [1] : e.ULONG;
  224.     size      [0] : e.ULONG )
  225.   : BOOLEAN;
  226. PROCEDURE DeviceTuple* [base,-78]
  227.   ( tupleData [8] : e.APTR;
  228.     storage   [9] : DeviceTDataPtr )
  229.   : e.ULONG;
  230. PROCEDURE IfAmigaXIP* [base,-84]
  231.   ( handle [10] : CardHandlePtr )
  232.   : e.ResidentPtr;
  233. PROCEDURE CardForceChange* [base,-90] ()
  234.   : BOOLEAN;
  235. PROCEDURE CardChangeCount* [base,-96] ()
  236.   : e.ULONG;
  237. PROCEDURE CardInterface* [base,-102] ()
  238.   : e.ULONG;
  239.  
  240. BEGIN base := NIL
  241. END CardRes.
  242.